package cn.lwj.webService.entity;

import org.apache.commons.lang.builder.ToStringBuilder;


public abstract class BaseBean implements java.io.Serializable {
    
    private static final long serialVersionUID = 456013017939483936L;
    private int count = 0; // 记录总数
	private int pageSize = 20; // 每页显示记录数
	private int pageCount = 0; // 总页数
	private int page = 1; // 当前页数
	private int startRow = 0;
	private int endRow = 0;

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		if (pageSize != 0) {
			pageCount = count / pageSize;
			if (count % pageSize != 0) {
				pageCount++;
			}
		}
		this.count = count;
	}

	public int getPageCount() {
		return pageCount;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public int getStartRow() {
		if (this.pageSize != 0 && this.page > 1) {
			this.startRow = (this.page - 1) * this.pageSize;
		}
		return startRow;
	}

	public void setStartRow(int startRow) {
		this.startRow = startRow;
	}

	public int getEndRow() {
		if (endRow == 0) {
			this.endRow = (this.page) * this.pageSize;
		}
		return endRow;
	}

	public void setEndRow(int endRow) {
		this.endRow = endRow;
	}
    
}
